#include <stdio.h>
#include<string.h>
#define len1 50
#define len2 50
int main()
{

	char str[len1] = { 0 }, cut[len2] = { 0 };
	int i = 0, j = 0, flag = 0;
	gets(str);
	gets(cut);
	for (i = 0;str[i]!='\0';i++)
	{
		for (j = 0;str[j] != '\0';j++)
		{
			if (str[i] == cut[j])
			{
				if (flag == 0)
				{
					flag = 1;
				}
				break;
			}
		}
		if (j >= strlen(cut))
		{
			if (flag == 0)
			{
				printf("%c", str[i]);
			}
			else
			{
				printf("\n%c", str[i]);
				flag = 0;
			}
		}
	}
	return 0;
}
